Day 11 - Find and replace text

80

-v, --invert-match

Invert the sense of matching, to select non-matching lines.

while the -i or --ignore-case option was already shown in the chapter.

Go back to the exercise

Exercise 11.03

Replace all letters e in the file examples.txt with a question mark ?, then find among the resulting

lines all the ones that have a space in them

Solution

$ cat examples.txt | sed s,"e","?",g | grep " "

Dug th? Dog

Polic? 101

corn dog

phas? spid?r

und?ad r?d dragon

[...]

There are no specific issues in using question mark and spaces, as long as you use quotes to surround

the latter.

Go back to the exercise